package RabbitUI;

import javax.swing.UIManager;

public class LooknFeel {
	
	
	public static String[] getAvailableLookAndFeelNames() {
		UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();

		String[] names = new String[lafs.length];
		for (int i = 0; i < lafs.length; ++i) {
			names[i] = lafs[i].getName();
		}

		return names;
	}
	public  static String getLookAndFeelClassName(String name) {
		UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();

		for (int i = 0; i < lafs.length; ++i) {
			if (name.equals(lafs[i].getName())) return lafs[i].getClassName();
		}

		return "";
	}
	public static String getLookAndFeelUpperClass(String lnf) {
		String[] installedLookAndFeel = getAvailableLookAndFeelNames();
		String tmp;
		for (int i=0 ;i<installedLookAndFeel.length;i++)
		{	tmp=installedLookAndFeel[i];
		if (lnf.startsWith(tmp.substring(0, 3))) return tmp;
		}

		return "";
	}
	public static String getLookAndFeelUpperClassName(String lnf) {
		return getLookAndFeelClassName(getLookAndFeelUpperClass(lnf));
	}
	
}
